#ifndef NOSAL_EXEC_INTERNAL_EXCEPTION_H_
#define NOSAL_EXEC_INTERNAL_EXCEPTION_H_

#include <string>
#include <stdexcept>
#include <cstdint>

namespace netaos {
namespace nosal {
namespace exec {
namespace internal {

/// @brief Base class for all Execution Management exceptions.
class Exception : public std::exception
{
    using Parent = std::exception;

public:
    /// @brief Constructor.
    ///
    /// @param message A string message.
    explicit Exception(const std::string& message) noexcept
        : Parent()
        , message_(message)
    { }

    /// @brief Constructor.
    ///
    /// @param message A C-string message.
    explicit Exception(const char* const message) noexcept
        : Parent()
        , message_(message)
    { }

    /// @brief Gets the string message
    ///
    /// @returns the string stored in this exception containing the message.
    virtual const std::string& GetMessage() const noexcept
    {
        return message_;
    }

    /// @brief Gets the C-string message
    ///
    /// @returns the C-string stored in this exception containing the message.
    virtual const char* what() const noexcept override
    {
        return message_.c_str();
    }

private:
    /// @brief String containing a message.
    std::string message_;
};

}  // namespace internal
}  // namespace exec
}  // namespace nosal
}  // namespace netaos

#endif  // NOSAL_EXEC_INTERNAL_EXCEPTION_H_
